<div class="container">
	<div class="row">
					<div class="col-md-8" id="wrap-left">
                    
                    <div class="view_breadcrumb" >
                    	<ul class="breadcrumb view_bread">
                        	<li><a href="<?php echo HOME; ?>"><i class="icon-home"></i> Home</a></li>
                            <li><a href="<?php echo url_category($data['category']['id'],$data['category']['alias']); ?>"><?php echo $data['category']['name']; ?></a></li>
                          
                        </ul>
                    
                    </div>
                    <div class="leftDetail">
						<div class="detail_view_image">
                          <h1 class="pull-left"><?php echo $data['post']['title'] ?></h1>

                          <div class="clr"></div>
                          
                          <div class="detail_popup_controller" id="popupControl-innerItem-<?= $data['post']['id']; ?>-image" data-href="<?= $data['post']['id']; ?>" data-rel="<?= $data['post']['type']; ?>">
                          	<div class="wrap-fb-like-popup">
                          		<div class="likePopupLabel">Thích bài này?</div>
                          		<div class="fb-like fb-like-popup fb_edge_widget_with_comment fb_iframe_widget" data-href="http://localhost/keme/index.php?module=news&amp;act=view&amp;id=5" data-width="200" data-layout="button_count" data-show-faces="false" data-send="false" fb-xfbml-state="rendered">
                          			<span style="height: 0px; width: 0px;"><iframe id="f7389b118" name="f18fb8cb4" scrolling="no" title="Like this content on Facebook." class="fb_ltr" src="http://www.facebook.com/plugins/like.php?api_key=&amp;channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D28%23cb%3Dff77a1c5c%26domain%3Dlocalhost%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff10e359df4%26relation%3Dparent.parent&amp;colorscheme=light&amp;extended_social_context=false&amp;href=http%3A%2F%2Flocalhost%2Fkeme%2Findex.php%3Fmodule%3Dnews%26act%3Dview%26id%3D5&amp;layout=button_count&amp;locale=en_US&amp;node_type=link&amp;sdk=joey&amp;send=false&amp;show_faces=false&amp;width=200" style="border: none; overflow: hidden; height: 0px; width: 0px;"></iframe>
                          			</span>
                          		</div>
                          		<div class="clr"></div>
                          	</div>
                          	<div class="controlNav">
                          		<a class="detail_controlNavItem" id="preNav" href="">&nbsp;</a>
                          		<a class="detail_controlNavItem" id="nextNav" href="">&nbsp;</a>
                          	</div>
                          	<div>
                          		<p class="report_post" data-href="<?= $data['post']['id']; ?>" data-rel="<?= $data['post']['type']; ?>" style="padding: 10px;">
                          			<a href="#"><i class="font12 blue icon-warning-sign" style="color: #cc0000"> </i> Báo bài xấu!</a>
                          		</p>
                          	</div><!-- end .popupControl -->
                         </div>
                         
                         

						  <input type="hidden" name="index_post_id" id="index_post_id" value="<?= $_GET['id'] ?>" />
									<!-- <div class="likePopupLabel">Thích bài này?</div> -->
							<div class="pull-right">
								<div class="fb-like" data-href="<?php echo url(); ?>" data-width="120" data-layout="button_count" data-show-faces="true" data-send="false"></div><br />
							</div>
				 					<div class="clearfix"></div>
									<ul class="list-inline moreinfo" id="detail_top_info">
                                    	<li><?php echo $data['post']['likes'] ?> Likes</li>
                                        <li><?php echo $data['post']['comments'] ?> Comments</li>
                                        <li><?php echo $data['post']['views'] ?> Views</li>
                                        <li class="pull-right view_time"><?php echo time_ago($data['post']['date_created']); ?></li>
                                       <li class="pull-right view_user"><?php echo $data['post']['username'] ?></li>
                                    </ul>
                                    
									<p id="detail_description"><?php echo $data['post']['description'] ?></p>
							
								<div id="detail_main_content" style="margin-top: 10px; text-align:center">
							
                            <?php if($data['post']['type']=='video'){ 
									  echo $data['post']['embed'];
							 }
							 ?>
                             
                             <?php if($data['post']['type']=='image'){ 
							 		  echo $data['post']['images_big'];
									
							 }?>
                             
								<?php if($data['post']['type']=='text'){ 
										echo $data['post']['description'];
							 }?>
                                </div>
					
							
							<div class="clr"></div>
								
							<div class="row detail_view_user">
                            	<div class="col-md-2" >
									<img src="<?= get_image($data['user']['avatar'], 'avatar/100');  ?>" class="img-responsive img-circle" >
                                </div>
                                
                                <div class="col-md-10" style="border-left:2px solid #0C9">
									<h4><a href="<?php echo url_user($data['post']['username']) ?>"><?php echo $data['post']['username'] ?></a></h4>
	                                <p><?php echo $data['user']['gioithieu'] ?></p>
									<ul class="list-inline moreinfo" id="detail_bottom_info">
		                                <li><?php echo $data['user']['likes']; ?> Likes</li>
		                                <li><?php echo $data['user']['views']; ?> Views</li>
		                                <li><?php echo $data['user']['comments']; ?> Comments</li>
		                                <li><?php echo $data['user']['post']; ?> Posts</li>
		                                <li><?php echo $data['user']['album']; ?> Albums</li>
	                                </ul>
	                                
	                                 <?php
									  if($data['user']['facebook'] ==1){?>
									  <span class="pull-left">
									   <a href="https://www.facebook.com/<?php echo $data['user']['facebook_id'];?>"><i class="icon-facebook"></i> Vist My Facebook</a>
									  </span>
									  <?php }?>
									  <span class="pull-right" style="color:#d35400">
									  <i class="icon-email"></i> <?php echo $data['user']['email']; ?>
									  </span>
									  <div class="clearfix"></div>
                                </div>
							</div><!-- end detail view user , row -->
                            
						</div><!-- end .detail view image -->
				
						<div class="facebook-comment col-md-12"><div class="fb-comments" data-href="<?php echo url(); ?>"></div></div>
					
                    </div> <!-- End of leftDetail-->		
					</div><!-- end .col-md-9  -->
                    
                    
                    <!-- Start Right Block -->
                    <div class="col-md-4">
                    <?php
					if($data['album'] && $data['album']['list_item']){
					?>
                    		<div class="view_breadcrumb"><?php echo $data['album']['name'] ;?></div>
                            <div class="body_right">
                           
                           	<div id="relatedPosts">
                            
                            <?php if($data['album']['list_item']){ 
										foreach($data['album']['list_item'] as $rp){?>
                                        <div class="item">
                                            <div class="innerItem" id="innerItem-2">
                                                <img class="itemImage" src="<?php echo $rp['image_small']; ?>" alt="" />
                                                <div class="moreinfo">
                                                    <h3><a class="right" href="<?php echo url_post($rp['id']); ?>"><?php echo $rp['title']; ?></a></h3>
                                                </div>
                                            </div><!-- end .innerItem -->
                                    </div><!-- end .item -->
							<?php 
										}
							}?>
							
						</div><!--  #relatedPosts-->

            
                            </div>
                    		<div class="bottom_right">
                            	<ul class="list-inline moreinfo2">
                                <li><?php echo $data['album']['likes']; ?> Likes</li>
                                <li><?php echo $data['album']['comments']; ?> Comments</li>
                                <li><?php echo $data['album']['posts']; ?> Posts</li>
                                    <li class="pull-right view_all"><a href="<?php echo url_album($data['album']['id']); ?>"><span class="glyphicon glyphicon-th-list"></span> Xem Hết </a></li>
                              
                                </ul>
                            </div>
                           <?php }?> 
                           
                          <bR/>
                          <bR/>  
                         <div class="rightBlock" id="rightNewThread">
						<h4 class="rightBlockTitle">
							Xem nhiều - 
							<a id="rightMostDayView" class="clickShowView" href="">ngày</a><span> /</span>
							<a id="rightMostWeekView" class="clickShowView" href="">tuần</a><span> /</span>
							<a id="rightMostMonthView" class="clickShowView" href="">tháng</a>
						</h4>
						
						<div class="innerRightBlock" id="show_rightMostDayView">
						<?php if($data['result_day_most_views']):?>
						
						<?php 
							foreach($data['result_day_most_views'] as $day_news): 
								$news = get_post($day_news['id']);
						?>
								<div class="rightItem">
									<a class="wrapRightImage" href="<?php echo url_post($day_news['id']); ?>"><img src="<?= $news['image_small']; ?>" style="max-width:90px" alt=""></a>
									<h4>
										<a class="rightItemTitle" href="<?php echo url_post($day_news['id']); ?>"><?= $news['title'];?></a> 
										<span style="font-weight: normal; color: #999;">-</span> 
										<a class="rightItemAuthor" href="<?php echo url_user($news['username']) ?>"><?php echo $news['username'] ?></a>
									</h4>
									<span class="pull-left font11 margin-right-10"><i class="font12 blue icon-eye-open"> </i><?= k_format($news['views']); ?></span> 
									<span class="pull-left font11 margin-right-10"><i class="font12 blue icon-thumbs-up-alt"> </i>34k</span> 
									<span class="pull-left font11 margin-right-10"><i class="font12 blue icon-comments"> </i>34k</span>
									<div class="clr"></div>
								</div><!-- end .rightItem -->
						<?php endforeach;?>
						<?php else: ?>
							
							
						
						<?php endif;?>
						</div><!-- end innerRightBlock -->
							
						<div class="innerRightBlock" id="show_rightMostWeekView"></div>
						
						<div class="innerRightBlock" id="show_rightMostMonthView"></div>	
							
					<script type="text/javascript">
						$(document).ready(function(){
							$('.clickShowView').click(function(e){
								e.preventDefault();
								$('.innerRightBlock').hide();
								
								task = $(this).attr('id');
								if($('#show_' + task).html().length){
									$('#show_' + task).fadeIn('normal');
								}else{
									$('#show_' + task).show();
									$('#show_' + task).append('<div id="rightShowLoading" class="loading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
									$('#rightShowLoading').show();
									
									//$('#loading').show();
									$.ajax({
										url: '<?= BASE_URL ?>index.php?module=ajax&act=ajax&' + task + '=1',
										type : 'POST',
										success: function(data){
											if(data){
												$('#show_' + task).append(data).hide().fadeIn('slow');
												$('#rightShowLoading').remove();
											}else{
												$('#show_' + task).append('Đang cập nhật dữ liệu.');
												$('#rightShowLoading').remove();
											}
											
										}
									});
								}
							});

							$('.detail_popup_controller').sticky();

							clicked = false;
							
							$('.detail_controlNavItem').live('click',function(e){
								
								console.log($('#index_post_id').val());
								$('#wrap-left').css('opacity', '0.5');
								e.preventDefault();
								
								nextOrPrev = $(this).attr('id');
								
								var iid = $('#index_post_id').val();
								if(clicked == false){
									clicked = true;
									$.ajax({
	
										url: '<?= BASE_URL; ?>index.php?module=ajax&act=ajax&detail_ajax_get_post=1&nav=' + nextOrPrev,
										type: 'POST',
										data: {id: iid},
										success: function(data){
											$('#wrap-left').css('opacity', '1');
											newData = JSON.parse(data);
											console.log(newData);
											if(newData.error == 'Not Exist'){
												
											}else if(newData.post){
												var userDetail = '';
												$('#index_post_id').val(newData.post.pid);
												$('h1.pull-left').html(newData.post.title);
												$('#detail_top_info').html('<li>'+newData.post.likes+' Likes</li><li>'+newData.post.comments+' Comments</li><li>'+newData.post.views+' Views</li><li class="pull-right view_time">'+newData.post.date_created+'</li><li class="pull-right view_user">'+newData.post.username);
												$('#detail_description').html(newData.post.description);
												$('#detail_main_content').html(newData.post.detail_main_content);
												$('.detail_view_user > .col-md-2').html('<img src="' + newData.post.user.avatar + '" alt="' + newData.post.username + '" class="img-responsive img-circle" />');
												userDetail += '<h4><a href="' + newData.post.user.link + '">' + newData.post.user.username + '</a></h4>';
												userDetail += '<p>' + newData.post.user.gioithieu + '</p>';
												userDetail += '<ul class="list-inline moreinfo" id="detail_bottom_info">'
												userDetail += '<li>' + newData.post.user.likes +' Likes</li>';
												userDetail += '<li>' + newData.post.user.views +' Views</li>';
												userDetail += '<li>' + newData.post.user.comments +' Comments</li>';
												userDetail += '<li>' + newData.post.user.post +' Posts</li>';
												userDetail += '<li>' + newData.post.user.album +' Albums</li>';
												userDetail += '</ul>';
												
												if(newData.post.user.facebook == 1){
													userDetail += '<span class="pull-left">';
													userDetail += '<a href="https://www.facebook.com/'+ newData.post.user.facebook_id +'>"><i class="icon-facebook"></i> Vist My Facebook</a>';
													userDetail += '</span>';
												}
												userDetail += '<span class="pull-right" style="color:#d35400">';
												userDetail += '<i class="icon-email"></i> ' + newData.post.user.email;
												userDetail += '</span><div class="clearfix"></div>';
	
												$('.detail_view_user > .col-md-10').html(userDetail);
												
											}
										},
									});
									clicked = false;
								}
							});
						});

					</script>	

					
					</div> <!-- END OF rightNewThread -->
                            
                    </div> <!-- End of md-colum-4 -->                    
                    <!-- End of Right Block -->
                    
                    
                    </div><!-- End of row -->
                    </div> <!-- End of container -->